package org.cheetahworkflow.designer.ui;

import org.eclipse.draw2d.ConnectionLayer;
import org.eclipse.draw2d.FreeformLayer;
import org.eclipse.draw2d.FreeformLayeredPane;
import org.eclipse.draw2d.LayeredPane;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.gef.editparts.GridLayer;
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
import org.eclipse.swt.graphics.Color;

public class WorkflowRootEditPart extends ScalableFreeformRootEditPart {

	@Override
	protected void createLayers(LayeredPane layeredPane) {
		GridLayer figure = new GridLayer();
		figure.setSpacing(new Dimension(40, 40));
		figure.setForegroundColor(new Color(null, 0xEC, 0xEC, 0xEC));
		layeredPane.add(figure, "Grid Layer");
		super.createLayers(layeredPane);
	}
	
	@Override
	protected LayeredPane createPrintableLayers() {
		FreeformLayeredPane layeredPane = new FreeformLayeredPane();
		// swap the z-order of layer in order to display the rapid view
		layeredPane.add(new ConnectionLayer(), "Connection Layer");
		layeredPane.add(new FreeformLayer(), "Primary Layer");
		return layeredPane;
	}
}
